<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-list"></i> 订单配送记录</h3>
        </div>
        <div class="panel-body">    
		<div class="navbar">                    
                <form id="search-form2" class="navbar-form form-inline"  method="get" action="/index.php/Seller/Order/driver_list" style="padding: 0;">
                    <div class="form-group">
                        <div class="input-group">
                            <input type="text" name="order_sn" id="order_sn" placeholder="订单编号" value="{:I('order_sn')}" class="form-control">
                        </div>
                    </div>



				 <div class="form-group">
                    <select name="driver_status" id="driver_status" class="form-control" style="width:110px;">
                        	<option value="">配送状态</option>
                    		<option value="2" <if condition='I("driver_status") eq 2'>selected</if> >已配送</option>
							<option value="1" <if condition='I("driver_status") eq 1'>selected</if>>未配送</option>
                    </select>
                </div>

                <div class="form-group">
                    <select name="pay_status" id="pay_status" class="form-control" style="width:110px;">
                        <option value="">支付状态</option>
                        <option value="2" <if condition='I("pay_status") eq 2'>selected</if> >已支付</option>
                        <option value="1" <if condition='I("pay_status") eq 1'>selected</if>>未支付</option>
                    </select>
                </div>

                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">
                                入库时间 <i class="fa fa-calendar"></i>
                            </div>
                            <input type="text" id="create_date" autocomplete="off" value="{$create_date}" name="create_date" class="form-control pull-right" style="width: 250px">
                        </div>
                    </div>

				 <div class="form-group">
				     <button type="submit" id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>
				      </div>
                <div class="form-group" style="float: right;">
                    <button type="button" class="btn btn-primary pull-right" id="daochu"><i class="fa fa-file-excel-o"></i>&nbsp;导出excel</button>
                </div>
                </form>    
          </div>                        
          <div id="ajax_return">                  
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
								<th class="sorting text-left">ID</th>
                                <th class="sorting text-left">单号</th>
                                <th class="sorting text-left">客户名称</th>
                                <th class="sorting text-left">订单金额</th>
								<th class="sorting text-left">配送状态</th>
								<th class="sorting text-left">送达时间</th>
								<th class="sorting text-left">支付状态</th>
								<th class="sorting text-left">支付时间</th>
                                <th class="sorting text-left">入库时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="list" id="v">
                                <tr>
									<td class="text-left">{$v.order_id}</td>
                                    <td class="text-left">{$v.order_sn}</td> 
                                    <td class="text-left">{$v.company}</td>
                                    <td class="text-left" style="color:#f39c12;">{$v.order_amount}</td>
                                    <if condition="$v['driver_status'] eq '未送达'">
										<td class="text-left" style="color:red;">未送达</td>
									<else/>
										<td class="text-left" style="color:blue;">已送达</td>
									</if>
									<td class="text-left">{$v.driver_time}</td>
									<td class="text-left">{$v.pay_status}</td>
									<td class="text-left">{$v.pay_time}</td>
									<td class="text-left">{$v.ruku_last_time}</td>
                                    <!--<td class="text-left"><a href="{:U('Admin/Distribut/editWithdrawals',array('id'=>$v[withdrawals_id]))}">查看</a></td>-->
                                </tr>
                            </volist>
							<tr>
								<td colspan="3" align="right"><b>合计：</b></td>
								<td style="font-size: 15px;color: #f39c12;font-size: 16px;">￥{$heji}</td>
							</tr>
                            </tbody>
                        </table>
                    </div>
                
                <div class="row">
                    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$show}</div>
                </div>
          
          </div>
        </div>
      </div>
    </div>
    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>
<!-- /.content-wrapper --> 
 <script>
 
$(document).ready(function() {
	$('#create_date').daterangepicker({
		format:"YYYY-MM-DD HH:mm",
		singleDatePicker: false,
		showDropdowns: true,
		minDate:'2021-01-01 00:00',
		maxDate:'2030-01-01 00:00',
		startDate:'{:date("Y-m-d")} 00:00',
		showWeekNumbers: true,
		timePicker: true,
		timePickerIncrement: 1,
		timePicker12Hour: false,
		ranges: {
		   '今天': [moment(), moment()],
		   '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
		   '最近7天': [moment().subtract('days', 6), moment()],
		   '最近30天': [moment().subtract('days', 29), moment()],
		   '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
		},
		opens: 'right',
		buttonClasses: ['btn btn-default'],
		applyClass: 'btn-small btn-primary',
		cancelClass: 'btn-small',
		locale : {
		    applyLabel : '确定',
		    cancelLabel : '取消',
		    fromLabel : '起始时间',
		    toLabel : '结束时间',
		    customRangeLabel : '自定义',
		    daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
		    monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
		    firstDay : 1
		}
	});
	    //废弃
		// $("#daochu").click(function(){
		// 	// alert('敬请期待。。。');return false;
		// 	var order_sn=$("#order_sn").val();
		// 	var consignee=$("#consignee").val();
		// 	var add_time=$("#create_date").val();
		// 	var order_status=$("#order_status").val() ?? '1,2';
		// 	var type="{:I('type')}";
		// 	location.href="/index.php/Seller/Finance/export_order_settled?order_sn="+order_sn+"&consignee="+consignee+"&timegap="+add_time+"&order_status="+order_status+'&type='+type;
		// })
    $("#daochu").click(function(){
        // alert('敬请期待。。。');return false;

        var order_sn=$("#order_sn").val();
        var pay_status=$("#pay_status").val();
        var create_date=$("#create_date").val();
        var driver_status=$("#driver_status").val();
        location.href="/index.php/Seller/Order/driver_list?order_sn="+order_sn+"&pay_status="+pay_status+"&create_date="+create_date+"&driver_status="+driver_status+'&type=export';
    })
});
</script>
</body>
</html>